<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>员工管理系统-登录</title>
<link rel="shortcut icon" href="static/layui/login/img/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="static/layui/layui/css/layui.css">
        <link rel="stylesheet" href="static/layui/login/css/login.css">
            <style>
            .codeBtn{
                float:right;
                color:blue;
                top:7px;
                left:75%;
                z-index:99;
            }
            </style>
            </head>
            <body>
            <div class="layui-carousel video_mask" id="login_carousel">
            <div carousel-item>
            <div class="carousel_div1"></div>
            </div>
            <div class="login layui-anim layui-anim-up">
            <div class="layui-logo">
              </div>
                <fieldset class="layui-elem-field layui-field-title">
                <legend class="text-white">员工管理系统-登录</legend>
                </fieldset>
                <div class="layui-form" >
                <div class="layui-form-item  form_code">
                <input id="name" name="name" type="text" placeholder="请输入登录名"   class="layui-input ">
                </div>
                <div class="layui-form-item  form_code">
                <input id="password" name="password" type="password" placeholder="请输入密码"   class="layui-input ">
                </div>
                
                
                
                
              </div>
                       
                <div class="layui-form-item  form_code">
                	
                	<input name="loginType" type="radio" value="1" id="loginType1" /><label style="color:white" for="loginType1">管理员 </label>
                	
                	<input name="loginType" type="radio" value="2" id="loginType2" /><label style="color:white" for="loginType2">用户 </label>
                	
                </div>
                
                 
                     <button class="login_btn layui-btn layui-btn-radius layui-btn-normal" onClick="submitForm()" >登录</button>
                    <hr class="layui-bg-gray">
                    <div class="layui-footer text-white">
                    <!-- 底部固定区域 -->
                员工管理系统
                    </div>
              </div>
            </div>
                    <script type="text/javascript" src="static/common/jquery-1.11.1.min.js"></script>
                        <script type="text/javascript" src="static/layui/layui/layui.all.js"></script>
                            <script type="text/javascript" src="static/layui/login/js/login.js"></script>
                                    </body>
                                    <script>
 function submitForm(){
 var loginType = $("input[name='loginType']:checked").val();
  $.ajax({
			  type: 'post',
			   url: 'LoginServlet?method=validLogin',
			   data: {
			   	'loginType':loginType,
			   	'name':$("#name").val(),
			 	'password':$("#password").val()
			   },
				  success: function(result) {
					result=$.parseJSON(result);
					if(result.code==0){
				  		alert(result.msg);
					}
				  if(result.code==1){
			   	if(loginType==1){
			   		window.location.href="AdminIndexServlet?method=goIndex";	
				}
			   	if(loginType==2){
			   		window.location.href="UserIndexServlet?method=goIndex";	
				}
				 }
 }
  });
 }

                                                    </script>
                                                    </html>
